package com.wdz.article_comment.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 文章评论表
 * </p>
 *
 * @author 吴传逞
 * @since 2020-12-29
 */
@TableName("article_comment")
public class ArticleComment extends Model<ArticleComment> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @NotNull
    @TableId(value = "id",type = IdType.UUID)
    private String id;
    /**
     * 关联的文章id
     */
    @NotNull
    @TableField("article_id")
    private String articleId;
    /**
     * 关联的文章title
     */
    @NotNull
    @TableField("article_title")
    private String articleTitle;
    /**
     * 关联的用户id
     */
    @TableField("user_id")
    private String userId;
    /**
     * 关联的用户头像
     */
    @TableField("user_image")
    private String userImage;
    /**
     * 关联的用户name
     */
    @TableField("user_name")
    private String userName;
    /**
     * 内容
     */
    @NotNull
    private String content;
    /**
     * 评论类型：0-普通评论，1-回复评论
     */
    private Integer type;
    /**
     * 回复评论对象的用户id
     */
    @TableField("accept_user_id")
    private String acceptUserId;
    /**
     * 回复评论对象的用户name
     */
    @TableField("accept_user_name")
    private String acceptUserName;
    /**
     * 回复评论对象的用户头像
     */
    @TableField("accept_user_image")
    private String acceptUserImage;
    /**
     * 创建时间
     */
    @TableField(value = "create_date", fill = FieldFill.INSERT)
    private String createDate;

    public String getCommentId() {
        return commentId;
    }

    public void setCommentId(String commentId) {
        this.commentId = commentId;
    }

    /**
     * 回复所属评论id
     */
    @TableField("comment_id")
    private String commentId;

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * 评论下面的回复
     */
    @TableField(exist = false)
    private List<ArticleComment> replys;

    @TableField(exist = false)
    private String email;


    public List<ArticleComment> getReplys() {
        return replys;
    }

    public void setReplys(List<ArticleComment> replys) {
        this.replys = replys;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getArticleId() {
        return articleId;
    }

    public void setArticleId(String articleId) {
        this.articleId = articleId;
    }

    public String getArticleTitle() {
        return articleTitle;
    }

    public void setArticleTitle(String articleTitle) {
        this.articleTitle = articleTitle;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserImage() {
        return userImage;
    }

    public void setUserImage(String userImage) {
        this.userImage = userImage;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getAcceptUserId() {
        return acceptUserId;
    }

    public void setAcceptUserId(String acceptUserId) {
        this.acceptUserId = acceptUserId;
    }

    public String getAcceptUserName() {
        return acceptUserName;
    }

    public void setAcceptUserName(String acceptUserName) {
        this.acceptUserName = acceptUserName;
    }

    public String getAcceptUserImage() {
        return acceptUserImage;
    }

    public void setAcceptUserImage(String acceptUserImage) {
        this.acceptUserImage = acceptUserImage;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "{" +
        ", id=" + id +
        ", articleId=" + articleId +
        ", articleTitle=" + articleTitle +
        ", userId=" + userId +
        ", userImage=" + userImage +
        ", userName=" + userName +
        ", content=" + content +
        ", type=" + type +
        ", acceptUserId=" + acceptUserId +
        ", acceptUserName=" + acceptUserName +
        ", acceptUserImage=" + acceptUserImage +
        ", createDate=" + createDate +
        "}";
    }
}
